package com.tvunetworks.center.device.controller;

import com.tvunetworks.center.common.util.Result;
import com.tvunetworks.center.common.util.ResultUtil;
import com.tvunetworks.center.device.service.TokenService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @program:
 * @description:
 * @author HenryChen
 * @create: 7/26/2019 3:58 PM
 **/
@RestController
@RequestMapping("/token")
@Slf4j
public class TokenController {


    @Autowired
    private  TokenService tokenService;

    /**
     *
     * @param tokenCode tokenCode
     * @param sid sid
     * @param jessionId jessionId
     * @param description description
     * @param willAddRIds willAddRIds
     * @return Result
     * @throws IOException 编译异常
     */
    @PostMapping("optGridToken")
    public Result optGridToken(@RequestParam String tokenCode, String sid, String jessionId,
                               String description, @RequestParam String willAddRIds) throws IOException {
        return ResultUtil.success(tokenService.pairTokenGrid(tokenCode, sid, jessionId, description, willAddRIds));
    }



}
